/**
 * Constants
 */
int DEFAULT_SLIME_SIZE = 55;
int SCREEN_X = 660;
int SCREEN_Y = 360;
int COLOUR_BG = #0000FF;

/**
 * Global variables
 */
Slime s;
Boolean up, down, right, left;

/**
 * pjs - only gets called once
 */
void setup(){  
   background(COLOUR_BG);
   size(SCREEN_X, SCREEN_Y); 
   s = new Slime(50, 55);
   up = false;
   down = false;
   right = false;
   left = false;
} 
/**
 * pjs - gets called repeatedly right after setup()
 */
void draw(){ 
   background(#0000FF);
   s.drawSlime();
   updateCoords();
   if(SCREEN_X < s.getXCoord()){
      s.setXCoord(0);
   }
   if(0 > s.getXCoord()){
      s.setXCoord(SCREEN_X);
   }
   if(SCREEN_Y < s.getYCoord()){
      s.setYCoord(0);
   }
   if(0 > s.getYCoord()){
      s.setYCoord(SCREEN_Y);
   }
}

void updateCoords(){
   if(up){
      s.setYCoord(s.getYCoord()-5);
   }
   if(down){
      s.setYCoord(s.getYCoord()+5);
   }
   if(right){
      s.setXCoord(s.getXCoord()+5);
   }
   if(left){
      s.setXCoord(s.getXCoord()-5);
   }
}

void keyPressed(){
   switch(key){
      case 'w': up = true; break;
      case 's': down = true; break;
      case 'a': left = true; break;
      case 'd': right = true; break;
   }
}

void keyReleased(){
   switch(key){
      case 'w': up = false; break;
      case 's': down = false; break;
      case 'a': left = false; break;
      case 'd': right = false; break;
   }
}



class Slime{
   int xCoord;
   int yCoord;
   int width;
   int height;
   
   Slime(){
      xCoord = 0;
      yCoord = 0;
      height = width  = DEFAULT_SLIME_SIZE;
   }
   Slime(int a, int b, int c, int d){
      xCoord = a;
      yCoord = b;
      width  = c;
      height = d;
   }
   Slime(int a, int b){
      xCoord = a;
      yCoord = b;
      height = width = DEFAULT_SLIME_SIZE;
   }
   void drawSlime(){
      arc(xCoord, yCoord, width, height, PI, TWO_PI);
   }
   void setCoords(int a, int b){
      setXCoord(a);
      setYCoord(b);
   }
   void setXCoord(int a){
      xCoord = a;
   }
   void setYCoord(int a){
      yCoord = a;
   }
   int getXCoord(){
      return xCoord;
   }
   int getYCoord(){
      return yCoord;
   }
   
}

class Ball{
   int weight;
   int width;
   int height;
   int xCoord;
}